package leetcode;

/**
 * @program: datastructureandalogorithm
 * @description:
 * @author: hmx
 * @create: 2022-02-21 19:42
 **/
public class LeetCode2180 {

    public int countEven(int num) {
        int ans = 0;

        for (int i = 2; i <= num; i++) {
            if (sum(i)) {
                ++ans;
            }
        }

        return ans;
    }

    boolean sum(int num) {
        int sum = 0;
        while (num != 0) {
            sum += num % 10;
            num /= 10;
        }
        return sum % 2 == 0;
    }

}
